Skip to content

feat: cluster likelihood per-step breakdowns (source-plane + image-plane chi²)#58

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cluster-likelihood-breakdown
Jul 9, 2026
Merged

feat: cluster likelihood per-step breakdowns (source-plane + image-plane chi²)#58
Jammy2211 merged 2 commits into
mainfrom
feature/cluster-likelihood-breakdown

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Cluster per-step likelihood breakdowns (issue #57; PyAutoMind feature/cluster/5_profiling.md — the last pre-LensTool item of the cluster home straight). New likelihood_breakdown/cluster/ in the house style (per-step jit_profile lower/compile/first/steady-state, JSON + bar chart into results/breakdown/cluster/, AUTOLENS_PROFILING_SMOKE=1 short-circuit, CPU fp64):

  • source_plane.py — decomposes FitPositionsSource (Lenstool's default likelihood) for the standard cluster model (2 main dPIE + 10 scaling members + NFW host; sources at z=1/2, multi-plane): per-system multi-plane ray-trace → magnification at the observed positions via the tracer Hessian → magnification-weighted chi² about the model source centre → LL assembly with the magnification-scaled noise normalization. The summed per-step LL is asserted against the eager production fit at rtol=1e-4 — and matches to 8 digits. Getting there surfaced three production-formula facts now documented in the script: the chi² weights residual distances by |μ|², name pairing hands the fit the model's Point centre (barycenter is only the no-profile fallback), and the noise normalization uses σ/μ. Total steady-state cost: 3.1 ms for the 6-image dataset, split roughly between ray-trace and Hessian-magnification steps.
  • image_plane.py — decomposes FitPositionsImagePairRepeat: back-trace setup → the triangle-tiling PointSolver forward-solve JIT-compiled per source plane (dominant; lower/compile/first-call reported separately so the one-off compile a sampler amortises is explicit) → the production fit total per system. Solver at the tutorial-scale grid (200×200 @ 0.7″, precision 0.01″), configuration recorded in the JSON.
  • simulators/cluster.py — brought up to the current standard model: adds the 10-member scaling tier on the reference-anchored relation shipped in autolens_workspace#238 (b0_ref=0.12 anchored at the brightest member, rs ∝ L^0.5) and writes scaling_galaxies.csv; previously this run-time tracker still built the 5-component pre-scaling-tier model.

Validation

  • source_plane.py end-to-end: per-step LL == production FitPositionsSource LL (rtol 1e-4; agreement to 8 significant digits). Artifacts written.
  • image_plane.py end-to-end: solve + fit totals per system, artifacts written (numbers on the issue).
  • Auto-simulation exercised from clean (simulator regenerated the dataset with the scaling tier through should_simulate).
  • AUTOLENS_PROFILING_SMOKE=1 short-circuit verified on both scripts; ruff clean.

Validation checklist (--auto run — in-session directives)

  • Effective level: supervised (header: supervised, cap: feature → supervised); launch directive "do the next task --auto"; Heart-ack carried in-session
  • Parallel-claim note: profiling-preopt-campaign holds autolens_profiling (diff: likelihood_runtime/sweep.py + scripts/build_baseline.py) — disjoint from this PR's files; re-verified at ship
  • Human: merge, amend, or reject — then log the outcome

🤖 Generated with Claude Code

…ane) + scaling tier in simulator

likelihood_breakdown/cluster/source_plane.py: FitPositionsSource decomposed
(multi-plane ray-trace -> hessian magnifications -> mag-weighted chi2 about
the model source centre -> LL with mag-scaled noise norm); per-step LL matches
the production fit to 8 digits (rtol 1e-4 assert). Total steady-state 3.1 ms.
Three production-formula facts documented en route: chi2 weights distances by
|mu|^2; name pairing hands the fit the model Point centre (barycenter only as
fallback); noise normalization uses sigma/mu.

likelihood_breakdown/cluster/image_plane.py: FitPositionsImagePairRepeat
decomposed; triangle-tiling PointSolver solve JIT'd per source plane
(compile ~10.5 s, steady ~0.32 s/call at 200x200 @0.7" precision 0.01");
fit totals ~2 s/system. Pytree registration mirrors simulators/cluster.py.

simulators/cluster.py: brought to the current standard model — adds the
10-member scaling tier on the reference-anchored relation (autolens_workspace
#238 convention, b0_ref=0.12, rs ∝ L^0.5) + writes scaling_galaxies.csv.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PUuWXiS23FvmfQPLvMNjeM
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit b1de4c7 into main Jul 9, 2026
1 check failed
@Jammy2211 Jammy2211 deleted the feature/cluster-likelihood-breakdown branch July 9, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release Queued for the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant